package com.esunny.resourcevisualization.manage;

import com.esunny.resourcevisualization.dao.ResourceTypeEntityDao;
import com.esunny.resourcevisualization.dao.ResourceTypeEntityDataDao;
import com.esunny.resourcevisualization.domain.response.ReturnStructure;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @version 1.0.0.0
 * @ClassName ResourceTypeEntityEntityDataManage
 * @Description 资源类别实体-资源类别实体字段值数据处理
 * @Author baochencong
 * @Date 2020/9/28 14:48
 */
@Component
public class ResourceTypeEntityEntityDataManage {

    @Resource
    private ResourceTypeEntityDao resourceTypeEntityDao;

    @Resource
    private ResourceTypeEntityDataDao resourceTypeEntityDataDao;

    private static Logger LOGGER = LoggerFactory.getLogger(ResourceTypeEntityEntityDataManage.class);

    public ReturnStructure deleteResourceTypeEntityByEntityId(int entityId) {
        try{
            resourceTypeEntityDao.deleteResourceTypeEntityByEntityId(entityId);
            resourceTypeEntityDataDao.deleteResourceTypeEntityDataByEntityId(entityId);
        }catch(Exception e){
            LOGGER.error("删除资源类别实体失败，报错信息为：");
            LOGGER.error(String.valueOf(e));
            return ReturnStructure.ERROR( "删除资源类别实体失败",null);
        }
        return ReturnStructure.SUCCESS("删除资源类别实体成功",null);
    }
}
